package com.tender.desensitization.factory.field;

import java.util.ArrayList;
import java.util.List;

public class FieldAnnotationDetectionFactoryFacade {

    List<FieldAnnotationDetectionFactory> factoryList = new ArrayList<>();

    public FieldAnnotationDetectionFactoryFacade() {
        factoryList.add(new FieldAnnotationCollectionDetectionFactory(this));
        factoryList.add(new FieldAnnotationArrayProcessFactory(this));
        factoryList.add(new FieldAnnotationUserWrapperProcessFactory(this));
    }

    public FieldAnnotationDetectionFactory getProcessFactory(Class<?> clazz) {
        return factoryList.stream().filter(item -> item.supports(clazz)).findFirst().orElse(null);
    }

    public void setTypeProcessFactory(FieldAnnotationDetectionFactory fieldAnnotationDetectionFactory) {
        factoryList.add(fieldAnnotationDetectionFactory);
    }

}
